import React, { Component } from "react"
import BetterScroll from 'better-scroll'

class App extends Component {
    constructor() {
        super()
        this.state = {
            name: []

        }
    }

    // 方法
    testa() {

        this.setState({
            name: [1, 2, 3, 4, 5, 6, 12312312, 7, 8, 123, 81111111111, 954, 64, 54, 45, 645]
        },
         () => {
            console.log(this.state.name)

            new BetterScroll('.wrapper', {
                movable: true,
                zoom: true
            })
        }
    )

    }

    render() {
        return (
            <div>
                <button onClick={this.testa.bind(this)}> edit </button>
                <div className="wrapper" style={{ height: '200px', backgroundColor: 'yellow', overflow: 'hidden' }}>

                    <ul className="content" >
                        {
                            this.state.name.map((item) =>

                                <li key={item}>{item}</li>
                            )
                        }
                    </ul>

                </div>

            </div>

        )
    }
}
export default App;